<?php
namespace Admin\Controller;
use Common\Controller\AdminController;

class JxsyszController extends AdminController{

	public function syskcgl(){
		$list = $this->getList('id,name,sort', 'course', null, 'sort asc,id desc', flase,null);
		$this->assign('list', $list);
		$this->display();
	}
	public function syskcgladd(){
		if(IS_POST){
			$result = $this->updateData($_POST, 'course');
			$this->returnResult($result,null,U('Jxsysz/syskcgl'));
		}
	}
	public function syskcgledit(){
        if(IS_POST){
			$result = $this->updateData($_POST, 'course',2);
			$this->returnResult($result);
		}else{
			$info = $this->getInfo('*', 'course', array('id' => I('get.id', 0, 'intval')));
			if($info){
				$data['info'] = $info;
				$data['status'] = 1;
			}else{
				$data['info'] = '数据不存在';
				$data['status'] = 0;
			}
			$this->ajaxReturn($data);
		}
	}
	public function syskcgldel(){
		$result = $this->deleteData('id=' . I('get.id', 0, 'intval'), 'course');
		$this->returnResult($result);
	}
	public function syskcglsetSort(){
		$sort = I('get.sort', 100, 'intval');
		$result = M('course')->where('id=' . I('get.id', 0, 'intval'))->setField('sort', $sort);
		$this->returnResult($result);
	}
	public function sysxmgl(){
		$list = $this->getList('id,name,sort', 'syxm', null, 'sort asc,id desc', flase,null);
		$this->assign('list', $list);
		$this->display();
	}
	public function sysxmgladd(){
		if(IS_POST){
			$result = $this->updateData($_POST, 'syxm');
			$this->returnResult($result,null,U('Jxsysz/sysxmgl'));
		}
	}
	public function sysxmgledit(){
        if(IS_POST){
			$result = $this->updateData($_POST, 'syxm',2);
			$this->returnResult($result);
		}else{
			$info = $this->getInfo('*', 'syxm', array('id' => I('get.id', 0, 'intval')));
			if($info){
				$data['info'] = $info;
				$data['status'] = 1;
			}else{
				$data['info'] = '数据不存在';
				$data['status'] = 0;
			}
			$this->ajaxReturn($data);
		}
	}
	public function sysxmgldel(){
		$result = $this->deleteData('id=' . I('get.id', 0, 'intval'), 'syxm');
		$this->returnResult($result);
	}
	public function sysxmglsetSort(){
		$sort = I('get.sort', 100, 'intval');
		$result = M('syxm')->where('id=' . I('get.id', 0, 'intval'))->setField('sort', $sort);
		$this->returnResult($result);
	}
}